﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Test.Model;
using System.Data.SqlClient;
using System.Data;

namespace Test.DAL
{
   public class ClassInfoDAL:BaseDAL<ClassInfo>
    {
        public  List<ClassInfo> Select(string name = "")
        {
            return Model.ClassInfo.Where(p => p.Name.Contains(name)).ToList();
        }
        //public  ClassInfo Select(int id)
        //{
        //    return Model.ClassInfo.Find(id);
        //}
        //public  int Insert(ClassInfo info)
        //{
        //    Model.ClassInfo.Add(info);
        //    return Model.SaveChanges();
        //}
        //public int Delete(ClassInfo info)
        //{
        //    Model.ClassInfo.Remove(info);
        //    return Model.SaveChanges();
        //}
        public  int Update(ClassInfo info)
        {
            var cls = Model.ClassInfo.Find(info.Id);
            cls.Name = info.Name;
            cls.Comment = info.Comment;
            return Model.SaveChanges();
        }
    }
}
